<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.ejoysoft.common.Constants,com.ejoysoft.util.ParamUtil,com.ejoysoft.wlanyz.business.Testpjmanage,com.ejoysoft.common.*,com.ejoysoft.wlanyz.business.Ac,java.io.File,java.util.ArrayList,java.util.Vector,java.io.FileNotFoundException"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	try {
		Testpjmanage obj = new Testpjmanage(globa, false);

		String strUrl = "testpjmanage_list.jsp";
		String strUrl1 = "testpjmanage_add.jsp";
		if (action.equals(Constants.DELETE_STR)) {
		
			String[] aryStrId = ParamUtil.getStrArray(request, "strProjectId");
			for (int i = 0; i < aryStrId.length; i++) {
			    
				obj.delete("where strProjectId ='" + aryStrId[i] + "'");
			}
			globa.dispatch(true, strUrl);
		} else if (action.equals(Constants.ADD_STR)) {
		    String strProjectNote = ParamUtil.getString(request, "strProjectNote", "");
			String strProjectName = ParamUtil.getString(request, "strProjectName", "");
		    Testpjmanage obj1 = new  Testpjmanage(globa);  
		    String where = "  where strProjectName = '"+strProjectName+"'";  
		    Vector<Testpjmanage> vctObj = obj1.list(where,0,0); 
		    if(vctObj.size()>0)
		    {globa.dispatch(false, strUrl1, "该测试项已经存在，不能继续添加！");}
		    else
		     globa.dispatch(obj.add(strProjectNote,strProjectName), strUrl);   
			
			
		}
		else if(action.equals(Constants.UPDATE_STR)){
            String  strProjectId=ParamUtil.getString(request,"strProjectId","");
            String strProjectNote = ParamUtil.getString(request, "strProjectNote", "");
			String strProjectName = ParamUtil.getString(request, "strProjectName", "");
			
                 globa.dispatch(obj.update(strProjectId,strProjectName,strProjectNote),strUrl);
      }

		
		globa.closeCon();
	}

	catch (Exception e) {
		e.printStackTrace();
	}
%>